/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.googlecode.datawander.shemareader;

import java.util.Arrays;

/**
 *
 * @author Marcin Stachniuk
 */
public class MetaClassField {

    private String type;
    private String valueName;
    private boolean primaryKey = false;
    private boolean foreignKey = false;
    private String [] primaryKeyReferenceTable;
    private String [] primaryKeyReferenceColumn;
    private String [] primaryKeyReferenceName;
    private boolean unique = false;
    private String foreignFieldTable;
    private String foreignFieldColumn;
    private String foreignFieldReferenceName;

    public boolean isForeignKey() {
        return foreignKey;
    }

    public void setForeignKey(boolean foreignKey) {
        this.foreignKey = foreignKey;
    }

    public boolean isPrimaryKey() {
        return primaryKey;
    }

    public void setPrimaryKey(boolean primaryKey) {
        this.primaryKey = primaryKey;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public boolean isUnique() {
        return unique;
    }

    public void setUnique(boolean unique) {
        this.unique = unique;
    }

    public String getValueName() {
        return valueName;
    }

    public void setValueName(String valueName) {
        this.valueName = valueName;
    }

    public String getForeignFieldColumn() {
        return foreignFieldColumn;
    }

    public void setForeignFieldColumn(String foreignFieldColumn) {
        this.foreignFieldColumn = foreignFieldColumn;
    }

    public String getForeignFieldTable() {
        return foreignFieldTable;
    }

    public void setForeignFieldTable(String foreignFieldTable) {
        this.foreignFieldTable = foreignFieldTable;
    }

    public String[] getPrimaryKeyReferenceColumn() {
        return primaryKeyReferenceColumn;
    }

    public void setPrimaryKeyReferenceColumn(String[] primaryKeyReferenceColumn) {
        this.primaryKeyReferenceColumn = primaryKeyReferenceColumn;
    }

    public String[] getPrimaryKeyReferenceTable() {
        return primaryKeyReferenceTable;
    }

    public void setPrimaryKeyReferenceTable(String[] primaryKeyReferenceTable) {
        this.primaryKeyReferenceTable = primaryKeyReferenceTable;
    }

    public String getForeignFieldReferenceName() {
        return foreignFieldReferenceName;
    }

    public void setForeignFieldReferenceName(String foreignFieldReferenceName) {
        this.foreignFieldReferenceName = foreignFieldReferenceName;
    }

    public String[] getPrimaryKeyReferenceName() {
        return primaryKeyReferenceName;
    }

    public void setPrimaryKeyReferenceName(String[] primaryKeyReferenceName) {
        this.primaryKeyReferenceName = primaryKeyReferenceName;
    }

    @Override
    public String toString() {
        return "[MetaClassField, type = "+type+" valueName = "+valueName+" primaryKey = "+
                primaryKey+" foreignKey = "+foreignKey+ " unique = "+unique+
                "foreignFieldTable = "+foreignFieldTable+" foreignFieldColumn = "+
                foreignFieldColumn+" foreignFieldReferenceName = "+foreignFieldReferenceName+
                "]";
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final MetaClassField other = (MetaClassField) obj;
        if ((this.type == null) ? (other.type != null) : !this.type.equals(other.type)) {
            return false;
        }
        if ((this.valueName == null) ? (other.valueName != null) : !this.valueName.equals(other.valueName)) {
            return false;
        }
        if (this.primaryKey != other.primaryKey) {
            return false;
        }
        if (this.foreignKey != other.foreignKey) {
            return false;
        }
        if (!Arrays.deepEquals(this.primaryKeyReferenceTable, other.primaryKeyReferenceTable)) {
            return false;
        }
        if (!Arrays.deepEquals(this.primaryKeyReferenceColumn, other.primaryKeyReferenceColumn)) {
            return false;
        }
        if (!Arrays.deepEquals(this.primaryKeyReferenceName, other.primaryKeyReferenceName)) {
            return false;
        }
        if (this.unique != other.unique) {
            return false;
        }
        if ((this.foreignFieldTable == null) ? (other.foreignFieldTable != null) : !this.foreignFieldTable.equals(other.foreignFieldTable)) {
            return false;
        }
        if ((this.foreignFieldColumn == null) ? (other.foreignFieldColumn != null) : !this.foreignFieldColumn.equals(other.foreignFieldColumn)) {
            return false;
        }
        if ((this.foreignFieldReferenceName == null) ? (other.foreignFieldReferenceName != null) : !this.foreignFieldReferenceName.equals(other.foreignFieldReferenceName)) {
            return false;
        }
        return true;
    }

    @Override
    public int hashCode() {
        int hash = 5;
        hash = 83 * hash + (this.type != null ? this.type.hashCode() : 0);
        hash = 83 * hash + (this.valueName != null ? this.valueName.hashCode() : 0);
        hash = 83 * hash + (this.primaryKey ? 1 : 0);
        hash = 83 * hash + (this.foreignKey ? 1 : 0);
        hash = 83 * hash + Arrays.deepHashCode(this.primaryKeyReferenceTable);
        hash = 83 * hash + Arrays.deepHashCode(this.primaryKeyReferenceColumn);
        hash = 83 * hash + Arrays.deepHashCode(this.primaryKeyReferenceName);
        hash = 83 * hash + (this.unique ? 1 : 0);
        hash = 83 * hash + (this.foreignFieldTable != null ? this.foreignFieldTable.hashCode() : 0);
        hash = 83 * hash + (this.foreignFieldColumn != null ? this.foreignFieldColumn.hashCode() : 0);
        hash = 83 * hash + (this.foreignFieldReferenceName != null ? this.foreignFieldReferenceName.hashCode() : 0);
        return hash;
    }

    
    
}
